package com.itcast.tanhuaserver.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itcast.tanhua.dubbo.server.api.UserLocationApi;
import com.itcast.tanhuaserver.domain.User;
import com.itcast.tanhuaserver.domain.UserThreadLocal;
import com.itcast.tanhuaserver.service.BaiduService;
import org.springframework.stereotype.Service;


@Service
public class BaiduServiceImpl implements BaiduService{
    @Reference(version = "1.0.0")
    private UserLocationApi userLocationApi;

    @Override
    public Boolean updateLocation(Double longitude, Double latitude, String address) {
        try {
            User user = UserThreadLocal.get();
            this.userLocationApi.updateUserLocation(user.getId().longValue(), longitude, latitude, address);
            return true;
        } catch (Exception e){
            e.printStackTrace();
        }
        return false;
    }
}
